// 创建 redux
import { createStore } from 'redux'
export const ADD = "ADD";
export const MINUS = "MINUS";
let initial = {
  count: 1
}

function reducer(state = initial, action) {
  if (action.typr === "add") {
    return { ...state, count: state.count + action.payload }
  };
  if (action.typr === "minus") {
    return { ...state, count: state.count - action.payload }
  };
  return state
};

export function addAction(payload) {
  return { type: ADD, payload };
}

export function minusAction(payload) {
  return { type: MINUS, payload }
}


let store = createStore(reducer)
export default store